import Control from "ol/control/Control";
import "./control.scss"
export function createControl(cb: (e: Event) => void, tagName: string = "div") {
    var el = document.createElement(tagName);
    el.className = "ol-unselectable ol-control ol-control-default-left-3"
    const button = document.createElement("button"); // 开关按钮
    button.innerHTML = '\u2212'
    button.type = "button"
    button.onclick = cb
    // button.setAttribute("title", " this.closeText"); // 设置提示文字
    // button.className = "off";
    el.appendChild(button);


    // let closeClassName = "ol-off"
    // document.body.append(el);
    return new Control({
        element: el,
        // target:el
        // , render: me =>{console.log(me)}
    })
}